
// 封装卷面生成函数
function testPaper(questionList) {
  // 清空页面
  document.querySelector('.questionLi').innerHTML = ''

  // 2.试卷生成
  // 动态生成试卷
  let strQ = ''
  let strC = ''
  let strT = ''
  // 遍历题目
  questionList.forEach((questionItem, index) => {
    strQ += `<div class="question" data-id="${index}">`
    // 题干
    strQ += `
      <h3 >
        ${questionItem.id}.   
        <span>(${questionItem.type}题, 2.0 分)</span>
        <div>
          ${questionItem.question}
        </div>
      </h3>
    `
    // 遍历答案
    strC = questionItem.options.map(item => {
      return `
        <div class="answer">
          <div>
            <span class="num_option" >${item.option}</span>
            <div>${item.value}</div>
          </div>
        </div>
      `
    }).join('')
    strQ += `<form action="">${strC}</form>`
    strQ += `</div>` // 闭合div
  })
  document.querySelector('.questionLi').innerHTML += strQ
}

